<template>
  <view>
    <u-datetime-picker :show="show" :title="title" v-model="value1" mode="datetime" @confirm="onConfirm"
      @cancel="oncancel"></u-datetime-picker>
  </view>
</template>

<script>
  const dayjs = require('dayjs');
  export default {
    props: ['show','title'],
    data() {
      return {
        value1: Number(new Date()),
      }
    },
    methods: {
      onConfirm(e) {
        const formattedDate = dayjs(e.value).format('YYYY-MM-DD HH:mm:ss');
        this.$emit('onConfirm', formattedDate)
      },
      oncancel(e) {
        this.$emit('onCancel', false)
      }
    }
  }
</script>

<style lang="less" scoped>

</style>